import axios from '@/libs/api.request'

export const loginREQ = ({
  userName,
  password
}) => {
  const data = {
    userName,
    password
  }
  return axios.request({
    url: 'dologin',
    data,
    method: 'POST'
  })
}
export const userListREQ = (pare) => {
  let params = null
  if (pare) params = { 'name': pare.name, 'page.number': pare.number, 'page.size': pare.size }
  return axios.request({ url: 'basic/user/list', params, method: 'GET' })
}

export const loginOutREQ = () => {
  return axios.request({
    url: 'loginout',
    method: 'GET'
  })
}

export const getUserREQ = (id) => {
  const _url = `basic/user/get/${id}`
  return axios.request({
    url: _url,
    method: 'GET'
  })
}

export const saveUserREQ = (pare) => {
  return axios.request({
    url: 'basic/user/save',
    data: pare,
    method: 'POST'
  })
}

export const updateUserREQ = (pare) => {
  return axios.request({
    url: 'basic/user/update',
    data: pare,
    method: 'PUT'
  })
}

export const deleteUserREQ = (pare) => {
  const _url = `basic/user/delete/${pare}`
  return axios.request({
    url: _url,
    method: 'DELETE'
  })
}
